
data = readtable('../data/agg/Data_FRED2019_Updated.xls','Sheet','data', ...
    'Range','AX3:BJ300');
if SET.usecore
data = readtable('../data/agg/Data_FRED2019_Updated_Core.xls','Sheet','data', ...
    'Range','AX3:BJ300');
end

SET.EST.varobs = { ...
    'iobs','pinfobs','dy','dc','dinve'} ;
SET.EST.varobs_names = { ...
    'Fed Funds Rate','Inflation', '$\Delta$ Output', '$\Delta$ Consumption', '$\Delta$ Investment'} ;

data = data(:,SET.EST.varobs);

SET.EST.obs = [
    SET.variable.iobs
    SET.variable.pinfobs
    SET.variable.dy
    SET.variable.dc
    SET.variable.dinve] ;

Zobs = table2array(data) ;
Zobs = 1*Zobs' ;

date_vec = 1962:.25:2020.75 ;

Zobs = Zobs(:,find(date_vec==start_date):find(date_vec==end_date)) ;
date_vec = date_vec(find(date_vec==start_date):find(date_vec==end_date)) ; SET.date_vec = date_vec ;

data_dates = date_vec ;

SET.data = Zobs ;
nobs = length(Zobs(:,1)) ;
SET.EST.nobs = nobs ;
SET.EST.ss = length(Zobs(1,:)) ;

zlb_t = zeros(1,SET.EST.ss) ;
zlb_t(find(date_vec==2009):find(date_vec==2015.5)) = 1 ;

% ZLB 
zlb_start = date_vec(find(date_vec==2009)) ; SET.zlb_start_idx = find(date_vec==2009) ;
zlb_end   = date_vec(find(date_vec==2015.5)) ;

T_f   = zeros(1,SET.EST.ss) ;

if end_date>2008.75
% Durations assumed
T_f(zlb_t>0) =  round([6.2097    5.8613    5.0713    4.5748    4.3537  ...
    5.5664    7.0992 8.3829    5.6791    5.3383    8.8957   10.5846   ...
    10.9704   11.7437 12.0144   12.0463   10.7932    8.6387    7.1684 ...
    7.2150    6.1610 5.8534    5.1121    3   2  1  1 ]); 
    % updated 2014Q4 to liftoff in 2015Q3 (from December 2014 FRBNY survey of primary dealers)
    % updated 2015Q1 to liftoff in 2015Q3 (from March 2015 FRBNY survey of primary dealers)
    % updated 2015Q2 to liftoff in 2015Q3 (from June 2015 FRBNY survey of primary dealers)
    % updated 2015Q3 to liftoff in 2015Q4 (from September 2015 FRBNY survey of primary dealers)
end

SET.zlb_t = zlb_t ;
SET.T_f   = T_f ;    

